#include "TreeReader.h"

Node* TreeReader::createTree(IDataReader* reader)
{
	switch(reader->getChar())
	{
	case 0:
		return new Node(reader->getChar(),0);
		break;
	case 1:
		return new Node(createTree(reader),NULL);
		break;
	case 2:
		return new Node(NULL,createTree(reader));
		break;
	case 3:
		return new Node(createTree(reader),createTree(reader));
		break;
	default:
		//do nothing
		break;
	}
}

INode* TreeReader::read(IDataReader* reader)
{
	return createTree(reader);
}